#ifndef _IM_SERVER_ADD_CONTACT_TASK_
#define _IM_SERVER_ADD_CONTACT_TASK_

#include <string>
#include "contact_thread_manager.h"

namespace imserver {

using apache::thrift::concurrency::Runnable;

class ContactRedis;
class ContactMySql;

class AddContactTask : public Runnable {
 public:
  AddContactTask(ContactRedis * redis, ContactMySql * mysql, const int64_t sender, const int64_t receiver, time_t timestamp) 
      : redis_(redis), mysql_(mysql), sender_(sender), receiver_(receiver), timestamp_(timestamp) {}
  virtual void run();
 private:
  ContactRedis * redis_;
  ContactMySql * mysql_;
  int64_t sender_;
  int64_t receiver_;
  time_t timestamp_;
};

class AddFavoriteTask : public Runnable {
 public:
  AddFavoriteTask(ContactRedis * redis, ContactMySql * mysql, const int64_t sender, const int64_t receiver, time_t timestamp) 
      : redis_(redis), mysql_(mysql), sender_(sender), receiver_(receiver), timestamp_(timestamp) {}
  virtual void run();
 private:
  ContactRedis * redis_;
  ContactMySql * mysql_;
  int64_t sender_;
  int64_t receiver_;
  time_t timestamp_;
};

}

#endif // _IM_SERVER_ADD_CONTACT_TASK_

